package com.fengye.algorithms.huawei;

import java.util.Iterator;
import java.util.Scanner;
import java.util.TreeSet;

/**
 * https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0?tpId=37&tags=&title=&difficulty=0&judgeStatus=0&rp=1&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37
 * @Author fengye
 * @Date 2023/4/7 10:13
 **/
public class MinMInRandNumber {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = 0;
        int i = 0;
        TreeSet<Integer> set = new TreeSet<>();
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            if (i == 0) {
                n = in.nextInt();
                i++;
                continue;
            }

            int a = in.nextInt();
            set.add(Integer.valueOf(a));
            i++;
            if (i == (n + 1)) {
                Iterator<Integer> itr = set.iterator();
                while (itr.hasNext()) {
                    System.out.println(itr.next());
                }
            }
        }
    }
}
